<template>
  <PageWrapper>
    <template #headerContent>
      <h1 style="font-size: 20px; line-height: 40px">点内外部触发事件</h1>
    </template>

    <ClickOutSide @clickOutside="handleClickOutside">
      <div @click="innerClick" class="demo-box">
        {{ text }}
      </div>
    </ClickOutSide>
  </PageWrapper>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { PageWrapper } from '@/components/Page/index'
import { ClickOutSide } from '@/components/ClickOutSide'

export default defineComponent({
  components: { PageWrapper, ClickOutSide },
  setup() {
    const text = ref('Click')
    function handleClickOutside() {
      text.value = 'Click Out Side'
    }

    function innerClick() {
      text.value = 'Click Inner'
    }
    return { innerClick, handleClickOutside, text }
  }
})
</script>

<style scoped>
.demo-box {
  display: flex;
  width: 100%;
  height: 300px;
  font-size: 24px;
  color: #fff;
  background-color: #408ede;
  border-radius: 10px;
  justify-content: center;
  align-items: center;
}
</style>
